<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>教师列表</title>
</head>
<body>
{#向course目录发送表单数据，会被urls.py接受#}
<form action="../teacher" style="margin: 10px 0">
    <input name="name" placeholder="请输入教师姓名/编号" value="{{ name }}" style="margin-right: 10px"/>
    <button type="submit">查询</button>
</form>
    <table border="1px" width="100%" style="border-collapse: collapse;">
        <a href="../teacher/teacher_add">添加教师</a>
        <a href="../course/">课程管理</a>
        <a href="../major/">专业管理</a>
        <a href="../logout/">退出登录</a>
        <tr>
            <th>编号</th>
            <th>教师姓名</th>
            <th>电话号码</th>
            <th>操作</th>
        </tr>
    {#在model中index模块下传来了参数teachers#}
        {% for teacher in teachers %}
            <tr>
    {#        forloop.counter用于在for循环里面获取当前循环次数#}
    {#            <td align="center">{{ forloop.counter }} </td>#}
                <td align="center">{{ teacher.teacher_id }} </td>
                <td align="center">{{ teacher.name }} </td>
                <td align="center">{{ teacher.tel }} </td>
                <td align="center">
    {#                这里的路径，/course/edit是指网址的地址栏的后缀，由于主urls是从course发送，然后course目录下的urls.py#}
    {#                是edit发送到views目录下，根据urls表来进行跳转#}
                    <a href="../teacher/teacher_edit/?teacher_id={{ teacher.teacher_id }}">
                        编辑
                    </a>
                    <a href="../teacher/teacher_delete/?teacher_id={{ teacher.teacher_id }}">
                        删除
                    </a>
                </td>
            </tr>
        {% endfor %}
    </table>
    <div>
        {{ pager_str|safe }}
    </div>
</body>
</html>